package com.wanbatv.wangwangba;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.android.volley.toolbox.ImageLoader;

/**
 * Created by 俞亚楠 on 2015/10/29.
 */
public class ChengzhangrijiImageFragment extends Fragment {

    private ImageView mImageView = null;
    private String mUrl = null;
    private ImageLoader mImageLoader = null;

    public static ChengzhangrijiImageFragment newInstance(String url) {
        ChengzhangrijiImageFragment f = new ChengzhangrijiImageFragment();
        Bundle arg = new Bundle();
        arg.putString("url", url);
        f.setArguments(arg);
        return f;
    }

    public void setImageLoader(ImageLoader imageLoader) {
        mImageLoader = imageLoader;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_chengzhangriji_image, null);
        mImageView = (ImageView) view.findViewById(R.id.image_view);
        mUrl = getArguments().getString("url");
        mImageLoader.get(mUrl, ImageLoader.getImageListener(mImageView, 0, 0),
                mImageView.getWidth(),
                mImageView.getHeight(),
                ImageView.ScaleType.CENTER_CROP);
        return view;
    }
}
